package com.chen.servlet;/*
package com.chen.servlet;

import com.chen.entity.FlightEntity;
import com.chen.entity.UserEntity;
import com.chen.service.FlightService;
import com.chen.service.UserService;
import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;

import java.io.IOException;

@WebServlet("/buyTicket")
public class BuyTicketServlet extends HttpServlet {
    FlightService flightService = new FlightService();
    UserService userService = new UserService();
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        doPost(req, resp);
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String phone = req.getParameter("phone");
        String idStr = req.getParameter("id");
        flightService.strIsEmpty(phone, req, resp);
        flightService.strIsEmpty(idStr, req, resp);
        Integer id = Integer.parseInt(idStr);
        FlightEntity flightEntity = flightService.getByIdFlight(id);
        UserEntity userEntity = userService.getByPhoneUser(phone);
        req.setAttribute("flightEntity", flightEntity);
        req.setAttribute("userEntity", userEntity);
        req.getRequestDispatcher("buyTicket.jsp").forward(req, resp);
    }
}
*/
